package com.File_io_.stream;

import java.util.*;
import java.util.stream.Stream;

/**
 * @author 宋鑫宇
 * @version 1.0
 * Stream 流的获取方式
 */
public class Stream02 {

    public static void main(String[] args) {
        /*----------------------- Collection 集合获取流*/
        Collection<String> strings = new ArrayList<>();
        Stream<String> stream = strings.stream();

        /*--------------------- Map集合 获取流*/
        Map<String, Integer> map = new HashMap<>();
        //键key 流
        Stream<String> stream1 = map.keySet().stream();
        //值value 流
        Stream<Integer> stream2 = map.values().stream();
        //键key 值value 流 （拿整体）
        Stream<Map.Entry<String, Integer>> stream3 = map.entrySet().stream();

        /*---------------------数组获取流--------*/
        String[] names = {"jack","mary","smith","tom"};
        Stream<String> stream4 = Arrays.stream(names);
        Stream<String> names1 = Stream.of(names);

    }

}
